import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-08-14
 * Time: 21:34
 */
public class demo6 {
    public static void main1(String[] args) {
        File srcFile = new File("./abc");
        File destFile = new File("./abc11");

        boolean ok = srcFile.renameTo(destFile);//修改srcFile的文件名,修改成destFile
        System.out.println(ok);
    }

    public static void main(String[] args) {
        File srcFile = new File("./abc/def");
        File destFile = new File("./def");
        //相当于移动文件,把当前目录下的abc目录下的def,移动到当前目录下
        boolean ok = srcFile.renameTo(destFile);//修改srcFile的文件名,修改成destFile
        System.out.println(ok);
    }

}
